import mplfinance as mpf
from matplotlib.dates import date2num
import pandas as pd

df = pd.read_csv('./files/test02.csv')

df['Open'] = df['open']
df['Close'] = df['close']
df['High'] = df['high']
df['Low'] = df['low']
df['Volume'] = df['vol']
df['Date'] = df['trade_time']

# # 将 Date 设置为时间类型
df['Date'] = pd.to_datetime(df['Date'])
# # 将 日期 设置为index行索引
df.set_index('Date', inplace=True)

print(df)
# mpf.plot(df, type='ohlc')  # type设置线性样式 candle,ohlc,line,renko,pnf

# style设置显示分格 binance,blueskies,brasil,charles,checkers,classic,default,mike,nightclouds,sas,starsandstripes,yahoo
mpf.plot(df, style='starsandstripes')  


